package August;

import com.sun.xml.internal.fastinfoset.tools.XML_SAX_StAX_FI;

import java.util.Scanner;

public class Day0801 {

    //字符串反转
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        StringBuilder stringBuilder = new StringBuilder(s);

        System.out.println(stringBuilder.reverse().toString());
    }


    //公共子串计算
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s1 = scanner.nextLine();
        String s2 = scanner.nextLine();

        char[] char1 = s1.toCharArray();
        char[] char2 = s2.toCharArray();
        int[][] n = new int[char1.length+1][char2.length+1];
        int res = 0;

        for (int i = 1; i < n.length; i++) {
            for (int j = 1; j < n[i].length; j++) {
                if (char1[i-1] == char2[j-1]){
                    n[i][j] = n[i-1][j-1]+1;
                    if (n[i][j] > res)
                        res = n[i][j];
                }
            }
        }
        System.out.println(res);
    }
}
